00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef DISTR1_HPP
00011 #define DISTR1_HPP
00012 #include "gridpack/component/data_collection.hpp"
00013 #include "gridpack/parser/dictionary.hpp"
00014 #include "gridpack/utilities/string_utils.hpp"
00015 namespace gridpack {
00016 namespace parser {
00017 template <class _data_struct> class Distr1Parser
00018 {
00019 public:
00020
00021
00022
00023 explicit Distr1Parser()
00024 {
00025 }
00026
00027
00028
00029
00030 virtual ~Distr1Parser()
00031 {
00032 }
00033
00034
00035
00036
00037
00038
00039
00040 void extract(_data_struct &data_struct,
00041 gridpack::component::DataCollection *data)
00042 {
00043 double rval;
00044 int ival, r_id;
00045 std::string stmp;
00046
00047 if (!data->getValue(RELAY_NUMBER,&ival)) {
00048 ival = 0;
00049 data->addValue(RELAY_NUMBER, ival+1);
00050 } else {
00051 data->setValue(RELAY_NUMBER, ival+1);
00052 }
00053 r_id = ival;
00054
00055
00056 if (!data->getValue(RELAY_MODEL,&stmp,r_id)) {
00057 data->addValue(RELAY_MODEL, data_struct.model, r_id);
00058 } else {
00059 data->setValue(RELAY_MODEL, data_struct.model, r_id);
00060 }
00061
00062
00063 if (!data->getValue(RELAY_ID,&stmp,r_id)) {
00064 data->addValue(RELAY_ID, data_struct.id, r_id);
00065 } else {
00066 data->setValue(RELAY_ID, data_struct.id, r_id);
00067 }
00068
00069
00070 if (!data->getValue(RELAY_RS,&ival,r_id)) {
00071 data->addValue(RELAY_RS, data_struct.rs, r_id);
00072 } else {
00073 data->setValue(RELAY_RS, data_struct.rs, r_id);
00074 }
00075
00076
00077 if (!data->getValue(RELAY_MTYPE,&ival,r_id)) {
00078 data->addValue(RELAY_MTYPE, data_struct.mtype, r_id);
00079 } else {
00080 data->setValue(RELAY_MTYPE, data_struct.mtype, r_id);
00081 }
00082
00083
00084 if (!data->getValue(RELAY_BMON,&ival,r_id)) {
00085 data->addValue(RELAY_BMON, data_struct.bmon, r_id);
00086 } else {
00087 data->setValue(RELAY_BMON, data_struct.bmon, r_id);
00088 }
00089
00090
00091 if (!data->getValue(RELAY_IBUS1,&ival,r_id)) {
00092 data->addValue(RELAY_IBUS1, data_struct.ibus1, r_id);
00093 } else {
00094 data->setValue(RELAY_IBUS1, data_struct.ibus1, r_id);
00095 }
00096
00097
00098 if (!data->getValue(RELAY_JBUS1,&ival,r_id)) {
00099 data->addValue(RELAY_JBUS1, data_struct.jbus1, r_id);
00100 } else {
00101 data->setValue(RELAY_JBUS1, data_struct.jbus1, r_id);
00102 }
00103
00104
00105 if (!data->getValue(RELAY_ID1,&stmp,r_id)) {
00106 data->addValue(RELAY_ID1, data_struct.id1, r_id);
00107 } else {
00108 data->setValue(RELAY_ID1, data_struct.id1, r_id);
00109 }
00110
00111
00112 if (!data->getValue(RELAY_IBUS2,&ival,r_id)) {
00113 data->addValue(RELAY_IBUS2, data_struct.ibus2, r_id);
00114 } else {
00115 data->setValue(RELAY_IBUS2, data_struct.ibus2, r_id);
00116 }
00117
00118
00119 if (!data->getValue(RELAY_JBUS2,&ival,r_id)) {
00120 data->addValue(RELAY_JBUS2, data_struct.jbus2, r_id);
00121 } else {
00122 data->setValue(RELAY_JBUS2, data_struct.jbus2, r_id);
00123 }
00124
00125
00126 if (!data->getValue(RELAY_ID2,&stmp,r_id)) {
00127 data->addValue(RELAY_ID2, data_struct.id2, r_id);
00128 } else {
00129 data->setValue(RELAY_ID2, data_struct.id2, r_id);
00130 }
00131
00132
00133 if (!data->getValue(RELAY_IBUS3,&ival,r_id)) {
00134 data->addValue(RELAY_IBUS3, data_struct.ibus3, r_id);
00135 } else {
00136 data->setValue(RELAY_IBUS3, data_struct.ibus3, r_id);
00137 }
00138
00139
00140 if (!data->getValue(RELAY_JBUS3,&ival,r_id)) {
00141 data->addValue(RELAY_JBUS3, data_struct.jbus3, r_id);
00142 } else {
00143 data->setValue(RELAY_JBUS3, data_struct.jbus3, r_id);
00144 }
00145
00146
00147 if (!data->getValue(RELAY_ID3,&stmp,r_id)) {
00148 data->addValue(RELAY_ID3, data_struct.id3, r_id);
00149 } else {
00150 data->setValue(RELAY_ID3, data_struct.id3, r_id);
00151 }
00152
00153
00154 if (!data->getValue(RELAY_ZONE1_TIME,&rval,r_id)) {
00155 data->addValue(RELAY_ZONE1_TIME, data_struct.zone1_time, r_id);
00156 } else {
00157 data->setValue(RELAY_ZONE1_TIME, data_struct.zone1_time, r_id);
00158 }
00159
00160
00161 if (!data->getValue(RELAY_ZONE1_REACH,&rval,r_id)) {
00162 data->addValue(RELAY_ZONE1_REACH, data_struct.zone1_reach, r_id);
00163 } else {
00164 data->setValue(RELAY_ZONE1_REACH, data_struct.zone1_reach, r_id);
00165 }
00166
00167
00168 if (!data->getValue(RELAY_ZONE1_CENANG,&rval,r_id)) {
00169 data->addValue(RELAY_ZONE1_CENANG, data_struct.zone1_cenang, r_id);
00170 } else {
00171 data->setValue(RELAY_ZONE1_CENANG, data_struct.zone1_cenang, r_id);
00172 }
00173
00174
00175 if (!data->getValue(RELAY_ZONE1_CENDIS,&rval,r_id)) {
00176 data->addValue(RELAY_ZONE1_CENDIS, data_struct.zone1_cendis, r_id);
00177 } else {
00178 data->setValue(RELAY_ZONE1_CENDIS, data_struct.zone1_cendis, r_id);
00179 }
00180
00181
00182 if (!data->getValue(RELAY_ZONE2_TIME,&rval,r_id)) {
00183 data->addValue(RELAY_ZONE2_TIME, data_struct.zone2_time, r_id);
00184 } else {
00185 data->setValue(RELAY_ZONE2_TIME, data_struct.zone2_time, r_id);
00186 }
00187
00188
00189 if (!data->getValue(RELAY_ZONE2_REACH,&rval,r_id)) {
00190 data->addValue(RELAY_ZONE2_REACH, data_struct.zone2_reach, r_id);
00191 } else {
00192 data->setValue(RELAY_ZONE2_REACH, data_struct.zone2_reach, r_id);
00193 }
00194
00195
00196 if (!data->getValue(RELAY_ZONE2_CENANG,&rval,r_id)) {
00197 data->addValue(RELAY_ZONE2_CENANG, data_struct.zone2_cenang, r_id);
00198 } else {
00199 data->setValue(RELAY_ZONE2_CENANG, data_struct.zone2_cenang, r_id);
00200 }
00201
00202
00203 if (!data->getValue(RELAY_ZONE2_CENDIS,&rval,r_id)) {
00204 data->addValue(RELAY_ZONE2_CENDIS, data_struct.zone2_cendis, r_id);
00205 } else {
00206 data->setValue(RELAY_ZONE2_CENDIS, data_struct.zone2_cendis, r_id);
00207 }
00208
00209
00210 if (!data->getValue(RELAY_ZONE3_TIME,&rval,r_id)) {
00211 data->addValue(RELAY_ZONE3_TIME, data_struct.zone2_time, r_id);
00212 } else {
00213 data->setValue(RELAY_ZONE3_TIME, data_struct.zone2_time, r_id);
00214 }
00215
00216
00217 if (!data->getValue(RELAY_ZONE3_REACH,&rval,r_id)) {
00218 data->addValue(RELAY_ZONE3_REACH, data_struct.zone3_reach, r_id);
00219 } else {
00220 data->setValue(RELAY_ZONE3_REACH, data_struct.zone3_reach, r_id);
00221 }
00222
00223
00224 if (!data->getValue(RELAY_ZONE3_CENANG,&rval,r_id)) {
00225 data->addValue(RELAY_ZONE3_CENANG, data_struct.zone3_cenang, r_id);
00226 } else {
00227 data->setValue(RELAY_ZONE3_CENANG, data_struct.zone3_cenang, r_id);
00228 }
00229
00230
00231 if (!data->getValue(RELAY_ZONE3_CENDIS,&rval,r_id)) {
00232 data->addValue(RELAY_ZONE3_CENDIS, data_struct.zone3_cendis, r_id);
00233 } else {
00234 data->setValue(RELAY_ZONE3_CENDIS, data_struct.zone3_cendis, r_id);
00235 }
00236
00237
00238 if (!data->getValue(RELAY_DIRANG,&rval,r_id)) {
00239 data->addValue(RELAY_DIRANG, data_struct.dirang, r_id);
00240 } else {
00241 data->setValue(RELAY_DIRANG, data_struct.dirang, r_id);
00242 }
00243
00244
00245 if (!data->getValue(RELAY_THCUR,&rval,r_id)) {
00246 data->addValue(RELAY_THCUR, data_struct.thcur, r_id);
00247 } else {
00248 data->setValue(RELAY_THCUR, data_struct.thcur, r_id);
00249 }
00250
00251
00252 if (!data->getValue(RELAY_SEBTIME,&rval,r_id)) {
00253 data->addValue(RELAY_SEBTIME, data_struct.sebtime, r_id);
00254 } else {
00255 data->setValue(RELAY_SEBTIME, data_struct.sebtime, r_id);
00256 }
00257
00258
00259 if (!data->getValue(RELAY_SERCTIME,&rval,r_id)) {
00260 data->addValue(RELAY_SERCTIME, data_struct.serctime, r_id);
00261 } else {
00262 data->setValue(RELAY_SERCTIME, data_struct.serctime, r_id);
00263 }
00264
00265
00266 if (!data->getValue(RELAY_TRBTIME,&rval,r_id)) {
00267 data->addValue(RELAY_TRBTIME, data_struct.trbtime, r_id);
00268 } else {
00269 data->setValue(RELAY_TRBTIME, data_struct.trbtime, r_id);
00270 }
00271
00272
00273 if (!data->getValue(RELAY_TRRCTIME,&rval,r_id)) {
00274 data->addValue(RELAY_TRRCTIME, data_struct.trrctime, r_id);
00275 } else {
00276 data->setValue(RELAY_TRRCTIME, data_struct.trrctime, r_id);
00277 }
00278
00279
00280 if (!data->getValue(RELAY_BLTYPE1,&ival,r_id)) {
00281 data->addValue(RELAY_BLTYPE1, data_struct.bltype1, r_id);
00282 } else {
00283 data->setValue(RELAY_BLTYPE1, data_struct.bltype1, r_id);
00284 }
00285
00286
00287 if (!data->getValue(RELAY_BLINT1,&rval,r_id)) {
00288 data->addValue(RELAY_BLINT1, data_struct.blint1, r_id);
00289 } else {
00290 data->setValue(RELAY_BLINT1, data_struct.blint1, r_id);
00291 }
00292
00293
00294 if (!data->getValue(RELAY_BLRO1,&rval,r_id)) {
00295 data->addValue(RELAY_BLRO1, data_struct.blro1, r_id);
00296 } else {
00297 data->setValue(RELAY_BLRO1, data_struct.blro1, r_id);
00298 }
00299
00300
00301 if (!data->getValue(RELAY_BLTYPE2,&ival,r_id)) {
00302 data->addValue(RELAY_BLTYPE2, data_struct.bltype2, r_id);
00303 } else {
00304 data->setValue(RELAY_BLTYPE2, data_struct.bltype2, r_id);
00305 }
00306
00307
00308 if (!data->getValue(RELAY_BLINT2,&rval,r_id)) {
00309 data->addValue(RELAY_BLINT2, data_struct.blint2, r_id);
00310 } else {
00311 data->setValue(RELAY_BLINT2, data_struct.blint2, r_id);
00312 }
00313
00314
00315 if (!data->getValue(RELAY_BLRO2,&rval,r_id)) {
00316 data->addValue(RELAY_BLRO2, data_struct.blro2, r_id);
00317 } else {
00318 data->setValue(RELAY_BLRO2, data_struct.blro2, r_id);
00319 }
00320 }
00321
00322
00323
00324
00325
00326
00327
00328
00329 void parse(std::vector<std::string> &split_line,
00330 gridpack::component::DataCollection *data)
00331 {
00332 double rval;
00333 int nstr = split_line.size();
00334 int ival, r_id;
00335
00336
00337 if (!data->getValue(RELAY_NUMBER,&ival)) {
00338 ival = 0;
00339 data->addValue(RELAY_NUMBER, ival+1);
00340 } else {
00341 data->setValue(RELAY_NUMBER, ival+1);
00342 }
00343 r_id = ival;
00344
00345
00346 std::string stmp, model;
00347 gridpack::utility::StringUtils util;
00348 model = util.trimQuotes(split_line[1]);
00349 util.toUpper(model);
00350 if (!data->getValue(RELAY_MODEL,&stmp,r_id)) {
00351 data->addValue(RELAY_MODEL, model.c_str(), r_id);
00352 } else {
00353 data->setValue(RELAY_MODEL, model.c_str(), r_id);
00354 }
00355
00356
00357 if (nstr > 3) {
00358 model = util.clean2Char(split_line[3]);
00359 if (!data->getValue(RELAY_ID,&stmp,r_id)) {
00360 data->addValue(RELAY_ID, model.c_str(), r_id);
00361 } else {
00362 data->setValue(RELAY_ID, model.c_str(), r_id);
00363 }
00364 }
00365
00366
00367 if (nstr > 4) {
00368 if (!data->getValue(RELAY_RS,&ival,r_id)) {
00369 data->addValue(RELAY_RS, atoi(split_line[4].c_str()), r_id);
00370 } else {
00371 data->setValue(RELAY_RS, atoi(split_line[4].c_str()), r_id);
00372 }
00373 }
00374
00375
00376 if (nstr > 5) {
00377 if (!data->getValue(RELAY_MTYPE,&ival,r_id)) {
00378 data->addValue(RELAY_MTYPE, atoi(split_line[5].c_str()), r_id);
00379 } else {
00380 data->setValue(RELAY_MTYPE, atoi(split_line[5].c_str()), r_id);
00381 }
00382 }
00383
00384
00385 if (nstr > 6) {
00386 if (!data->getValue(RELAY_BMON,&ival,r_id)) {
00387 data->addValue(RELAY_BMON, atoi(split_line[6].c_str()), r_id);
00388 } else {
00389 data->setValue(RELAY_BMON, atoi(split_line[6].c_str()), r_id);
00390 }
00391 }
00392
00393
00394 if (nstr > 7) {
00395 if (!data->getValue(RELAY_IBUS1,&ival,r_id)) {
00396 data->addValue(RELAY_IBUS1, atoi(split_line[7].c_str()), r_id);
00397 } else {
00398 data->setValue(RELAY_IBUS1, atoi(split_line[7].c_str()), r_id);
00399 }
00400 }
00401
00402
00403 if (nstr > 8) {
00404 if (!data->getValue(RELAY_JBUS1,&ival,r_id)) {
00405 data->addValue(RELAY_JBUS1, atoi(split_line[8].c_str()), r_id);
00406 } else {
00407 data->setValue(RELAY_JBUS1, atoi(split_line[8].c_str()), r_id);
00408 }
00409 }
00410
00411
00412 if (nstr > 9) {
00413 model = util.clean2Char(split_line[9]);
00414 if (!data->getValue(RELAY_ID1,&stmp,r_id)) {
00415 data->addValue(RELAY_ID1, model.c_str(), r_id);
00416 } else {
00417 data->setValue(RELAY_ID1, model.c_str(), r_id);
00418 }
00419 }
00420
00421
00422 if (nstr > 10) {
00423 if (!data->getValue(RELAY_IBUS2,&ival,r_id)) {
00424 data->addValue(RELAY_IBUS2, atoi(split_line[10].c_str()), r_id);
00425 } else {
00426 data->setValue(RELAY_IBUS2, atoi(split_line[10].c_str()), r_id);
00427 }
00428 }
00429
00430
00431 if (nstr > 11) {
00432 if (!data->getValue(RELAY_JBUS2,&ival,r_id)) {
00433 data->addValue(RELAY_JBUS2, atoi(split_line[11].c_str()), r_id);
00434 } else {
00435 data->setValue(RELAY_JBUS2, atoi(split_line[11].c_str()), r_id);
00436 }
00437 }
00438
00439
00440 if (nstr > 12) {
00441 model = util.clean2Char(split_line[12]);
00442 if (!data->getValue(RELAY_ID2,&stmp,r_id)) {
00443 data->addValue(RELAY_ID2, model.c_str(), r_id);
00444 } else {
00445 data->setValue(RELAY_ID2, model.c_str(), r_id);
00446 }
00447 }
00448
00449
00450 if (nstr > 13) {
00451 if (!data->getValue(RELAY_IBUS3,&ival,r_id)) {
00452 data->addValue(RELAY_IBUS3, atoi(split_line[13].c_str()), r_id);
00453 } else {
00454 data->setValue(RELAY_IBUS3, atoi(split_line[13].c_str()), r_id);
00455 }
00456 }
00457
00458
00459 if (nstr > 14) {
00460 if (!data->getValue(RELAY_JBUS3,&ival,r_id)) {
00461 data->addValue(RELAY_JBUS3, atoi(split_line[14].c_str()), r_id);
00462 } else {
00463 data->setValue(RELAY_JBUS3, atoi(split_line[14].c_str()), r_id);
00464 }
00465 }
00466
00467
00468 if (nstr > 15) {
00469 model = util.clean2Char(split_line[15]);
00470 if (!data->getValue(RELAY_ID3,&stmp,r_id)) {
00471 data->addValue(RELAY_ID3, model.c_str(), r_id);
00472 } else {
00473 data->setValue(RELAY_ID3, model.c_str(), r_id);
00474 }
00475 }
00476
00477
00478 if (nstr > 16) {
00479 if (!data->getValue(RELAY_ZONE1_TIME,&rval,r_id)) {
00480 data->addValue(RELAY_ZONE1_TIME, atof(split_line[16].c_str()), r_id);
00481 } else {
00482 data->setValue(RELAY_ZONE1_TIME, atof(split_line[16].c_str()), r_id);
00483 }
00484 }
00485
00486
00487 if (nstr > 17) {
00488 if (!data->getValue(RELAY_ZONE1_REACH,&rval,r_id)) {
00489 data->addValue(RELAY_ZONE1_REACH, atof(split_line[17].c_str()), r_id);
00490 } else {
00491 data->setValue(RELAY_ZONE1_REACH, atof(split_line[17].c_str()), r_id);
00492 }
00493 }
00494
00495
00496 if (nstr > 18) {
00497 if (!data->getValue(RELAY_ZONE1_CENANG,&rval,r_id)) {
00498 data->addValue(RELAY_ZONE1_CENANG, atof(split_line[18].c_str()), r_id);
00499 } else {
00500 data->setValue(RELAY_ZONE1_CENANG, atof(split_line[18].c_str()), r_id);
00501 }
00502 }
00503
00504
00505 if (nstr > 19) {
00506 if (!data->getValue(RELAY_ZONE1_CENDIS,&rval,r_id)) {
00507 data->addValue(RELAY_ZONE1_CENDIS, atof(split_line[19].c_str()), r_id);
00508 } else {
00509 data->setValue(RELAY_ZONE1_CENDIS, atof(split_line[19].c_str()), r_id);
00510 }
00511 }
00512
00513
00514 if (nstr > 20) {
00515 if (!data->getValue(RELAY_ZONE2_TIME,&rval,r_id)) {
00516 data->addValue(RELAY_ZONE2_TIME, atof(split_line[20].c_str()), r_id);
00517 } else {
00518 data->setValue(RELAY_ZONE2_TIME, atof(split_line[20].c_str()), r_id);
00519 }
00520 }
00521
00522
00523 if (nstr > 21) {
00524 if (!data->getValue(RELAY_ZONE2_REACH,&rval,r_id)) {
00525 data->addValue(RELAY_ZONE2_REACH, atof(split_line[21].c_str()), r_id);
00526 } else {
00527 data->setValue(RELAY_ZONE2_REACH, atof(split_line[21].c_str()), r_id);
00528 }
00529 }
00530
00531
00532 if (nstr > 22) {
00533 if (!data->getValue(RELAY_ZONE2_CENANG,&rval,r_id)) {
00534 data->addValue(RELAY_ZONE2_CENANG, atof(split_line[22].c_str()), r_id);
00535 } else {
00536 data->setValue(RELAY_ZONE2_CENANG, atof(split_line[22].c_str()), r_id);
00537 }
00538 }
00539
00540
00541 if (nstr > 23) {
00542 if (!data->getValue(RELAY_ZONE2_CENDIS,&rval,r_id)) {
00543 data->addValue(RELAY_ZONE2_CENDIS, atof(split_line[23].c_str()), r_id);
00544 } else {
00545 data->setValue(RELAY_ZONE2_CENDIS, atof(split_line[23].c_str()), r_id);
00546 }
00547 }
00548
00549
00550 if (nstr > 24) {
00551 if (!data->getValue(RELAY_ZONE3_TIME,&rval,r_id)) {
00552 data->addValue(RELAY_ZONE3_TIME, atof(split_line[24].c_str()), r_id);
00553 } else {
00554 data->setValue(RELAY_ZONE3_TIME, atof(split_line[24].c_str()), r_id);
00555 }
00556 }
00557
00558
00559 if (nstr > 25) {
00560 if (!data->getValue(RELAY_ZONE3_REACH,&rval,r_id)) {
00561 data->addValue(RELAY_ZONE3_REACH, atof(split_line[25].c_str()), r_id);
00562 } else {
00563 data->setValue(RELAY_ZONE3_REACH, atof(split_line[25].c_str()), r_id);
00564 }
00565 }
00566
00567
00568 if (nstr > 26) {
00569 if (!data->getValue(RELAY_ZONE3_CENANG,&rval,r_id)) {
00570 data->addValue(RELAY_ZONE3_CENANG, atof(split_line[26].c_str()), r_id);
00571 } else {
00572 data->setValue(RELAY_ZONE3_CENANG, atof(split_line[26].c_str()), r_id);
00573 }
00574 }
00575
00576
00577 if (nstr > 27) {
00578 if (!data->getValue(RELAY_ZONE3_CENDIS,&rval,r_id)) {
00579 data->addValue(RELAY_ZONE3_CENDIS, atof(split_line[27].c_str()), r_id);
00580 } else {
00581 data->setValue(RELAY_ZONE3_CENDIS, atof(split_line[27].c_str()), r_id);
00582 }
00583 }
00584
00585
00586 if (nstr > 28) {
00587 if (!data->getValue(RELAY_DIRANG,&rval,r_id)) {
00588 data->addValue(RELAY_DIRANG, atof(split_line[28].c_str()), r_id);
00589 } else {
00590 data->setValue(RELAY_DIRANG, atof(split_line[28].c_str()), r_id);
00591 }
00592 }
00593
00594
00595 if (nstr > 29) {
00596 if (!data->getValue(RELAY_THCUR,&rval,r_id)) {
00597 data->addValue(RELAY_THCUR, atof(split_line[29].c_str()), r_id);
00598 } else {
00599 data->setValue(RELAY_THCUR, atof(split_line[29].c_str()), r_id);
00600 }
00601 }
00602
00603
00604 if (nstr > 30) {
00605 if (!data->getValue(RELAY_SEBTIME,&rval,r_id)) {
00606 data->addValue(RELAY_SEBTIME, atof(split_line[30].c_str()), r_id);
00607 } else {
00608 data->setValue(RELAY_SEBTIME, atof(split_line[30].c_str()), r_id);
00609 }
00610 }
00611
00612
00613 if (nstr > 31) {
00614 if (!data->getValue(RELAY_SERCTIME,&rval,r_id)) {
00615 data->addValue(RELAY_SERCTIME, atof(split_line[31].c_str()), r_id);
00616 } else {
00617 data->setValue(RELAY_SERCTIME, atof(split_line[31].c_str()), r_id);
00618 }
00619 }
00620
00621
00622 if (nstr > 32) {
00623 if (!data->getValue(RELAY_TRBTIME,&rval,r_id)) {
00624 data->addValue(RELAY_TRBTIME, atof(split_line[32].c_str()), r_id);
00625 } else {
00626 data->setValue(RELAY_TRBTIME, atof(split_line[32].c_str()), r_id);
00627 }
00628 }
00629
00630
00631 if (nstr > 33) {
00632 if (!data->getValue(RELAY_TRRCTIME,&rval,r_id)) {
00633 data->addValue(RELAY_TRRCTIME, atof(split_line[33].c_str()), r_id);
00634 } else {
00635 data->setValue(RELAY_TRRCTIME, atof(split_line[33].c_str()), r_id);
00636 }
00637 }
00638
00639
00640 if (nstr > 34) {
00641 if (!data->getValue(RELAY_BLTYPE1,&ival,r_id)) {
00642 data->addValue(RELAY_BLTYPE1, atoi(split_line[34].c_str()), r_id);
00643 } else {
00644 data->setValue(RELAY_BLTYPE1, atoi(split_line[34].c_str()), r_id);
00645 }
00646 }
00647
00648
00649 if (nstr > 35) {
00650 if (!data->getValue(RELAY_BLINT1,&rval,r_id)) {
00651 data->addValue(RELAY_BLINT1, atof(split_line[35].c_str()), r_id);
00652 } else {
00653 data->setValue(RELAY_BLINT1, atof(split_line[35].c_str()), r_id);
00654 }
00655 }
00656
00657
00658 if (nstr > 36) {
00659 if (!data->getValue(RELAY_BLRO1,&rval,r_id)) {
00660 data->addValue(RELAY_BLRO1, atof(split_line[36].c_str()), r_id);
00661 } else {
00662 data->setValue(RELAY_BLRO1, atof(split_line[36].c_str()), r_id);
00663 }
00664 }
00665
00666
00667 if (nstr > 37) {
00668 if (!data->getValue(RELAY_BLTYPE2,&ival,r_id)) {
00669 data->addValue(RELAY_BLTYPE2, atoi(split_line[37].c_str()), r_id);
00670 } else {
00671 data->setValue(RELAY_BLTYPE2, atoi(split_line[37].c_str()), r_id);
00672 }
00673 }
00674
00675
00676 if (nstr > 38) {
00677 if (!data->getValue(RELAY_BLINT2,&rval,r_id)) {
00678 data->addValue(RELAY_BLINT2, atof(split_line[38].c_str()), r_id);
00679 } else {
00680 data->setValue(RELAY_BLINT2, atof(split_line[38].c_str()), r_id);
00681 }
00682 }
00683
00684
00685 if (nstr > 39) {
00686 if (!data->getValue(RELAY_BLRO2,&rval,r_id)) {
00687 data->addValue(RELAY_BLRO2, atof(split_line[39].c_str()), r_id);
00688 } else {
00689 data->setValue(RELAY_BLRO2, atof(split_line[39].c_str()), r_id);
00690 }
00691 }
00692 }
00693
00694
00695
00696
00697
00698
00699 void store(std::vector<std::string> &split_line,_data_struct &data)
00700 {
00701
00702 int from_idx, to_idx;
00703 from_idx = atoi(split_line[0].c_str());
00704 data.from_bus = from_idx;
00705 to_idx = atoi(split_line[2].c_str());
00706 data.to_bus = to_idx;
00707
00708 std::string sval;
00709 gridpack::utility::StringUtils util;
00710 sval = util.trimQuotes(split_line[1]);
00711 util.toUpper(sval);
00712
00713
00714 strcpy(data.model, sval.c_str());
00715 int nstr = split_line.size();
00716
00717
00718 if (nstr > 3) {
00719 sval = util.clean2Char(split_line[3]);
00720 strcpy(data.id, sval.c_str());
00721 }
00722
00723
00724 if (nstr > 4) {
00725 data.rs = atoi(split_line[4].c_str());
00726 }
00727
00728
00729 if (nstr > 5) {
00730 data.mtype = atoi(split_line[5].c_str());
00731 }
00732
00733
00734 if (nstr > 6) {
00735 data.bmon = atoi(split_line[6].c_str());
00736 }
00737
00738
00739 if (nstr > 7) {
00740 data.ibus1 = atoi(split_line[7].c_str());
00741 }
00742
00743
00744 if (nstr > 8) {
00745 data.jbus1 = atoi(split_line[8].c_str());
00746 }
00747
00748
00749 if (nstr > 9) {
00750 sval = util.clean2Char(split_line[9]);
00751 strcpy(data.id1, sval.c_str());
00752 }
00753
00754
00755 if (nstr > 10) {
00756 data.ibus2 = atoi(split_line[10].c_str());
00757 }
00758
00759
00760 if (nstr > 11) {
00761 data.jbus2 = atoi(split_line[11].c_str());
00762 }
00763
00764
00765 if (nstr > 12) {
00766 sval = util.clean2Char(split_line[12]);
00767 strcpy(data.id2, sval.c_str());
00768 }
00769
00770
00771 if (nstr > 13) {
00772 data.ibus3 = atoi(split_line[13].c_str());
00773 }
00774
00775
00776 if (nstr > 14) {
00777 data.jbus3 = atoi(split_line[14].c_str());
00778 }
00779
00780
00781 if (nstr > 15) {
00782 sval = util.clean2Char(split_line[15]);
00783 strcpy(data.id3, sval.c_str());
00784 }
00785
00786
00787 if (nstr > 16) {
00788 data.zone1_time = atof(split_line[16].c_str());
00789 }
00790
00791
00792 if (nstr > 17) {
00793 data.zone1_reach = atof(split_line[17].c_str());
00794 }
00795
00796
00797 if (nstr > 18) {
00798 data.zone1_cenang = atof(split_line[18].c_str());
00799 }
00800
00801
00802 if (nstr > 19) {
00803 data.zone1_cendis = atof(split_line[19].c_str());
00804 }
00805
00806
00807 if (nstr > 20) {
00808 data.zone2_time = atof(split_line[20].c_str());
00809 }
00810
00811
00812 if (nstr > 21) {
00813 data.zone2_reach = atof(split_line[21].c_str());
00814 }
00815
00816
00817 if (nstr > 22) {
00818 data.zone2_cenang = atof(split_line[22].c_str());
00819 }
00820
00821
00822 if (nstr > 23) {
00823 data.zone2_cendis = atof(split_line[23].c_str());
00824 }
00825
00826
00827 if (nstr > 24) {
00828 data.zone3_time = atof(split_line[24].c_str());
00829 }
00830
00831
00832 if (nstr > 25) {
00833 data.zone3_reach = atof(split_line[25].c_str());
00834 }
00835
00836
00837 if (nstr > 26) {
00838 data.zone3_cenang = atof(split_line[26].c_str());
00839 }
00840
00841
00842 if (nstr > 27) {
00843 data.zone3_cendis = atof(split_line[27].c_str());
00844 }
00845
00846
00847 if (nstr > 28) {
00848 data.dirang = atof(split_line[28].c_str());
00849 }
00850
00851
00852 if (nstr > 29) {
00853 data.thcur = atof(split_line[29].c_str());
00854 }
00855
00856
00857 if (nstr > 30) {
00858 data.sebtime = atof(split_line[30].c_str());
00859 }
00860
00861
00862 if (nstr > 31) {
00863 data.serctime = atof(split_line[31].c_str());
00864 }
00865
00866
00867 if (nstr > 32) {
00868 data.trbtime = atof(split_line[32].c_str());
00869 }
00870
00871
00872 if (nstr > 33) {
00873 data.trrctime = atof(split_line[33].c_str());
00874 }
00875
00876
00877 if (nstr > 34) {
00878 data.bltype1 = atoi(split_line[34].c_str());
00879 }
00880
00881
00882 if (nstr > 35) {
00883 data.blint1 = atof(split_line[35].c_str());
00884 }
00885
00886
00887 if (nstr > 36) {
00888 data.blro1 = atof(split_line[36].c_str());
00889 }
00890
00891
00892 if (nstr > 37) {
00893 data.bltype2 = atoi(split_line[37].c_str());
00894 }
00895
00896
00897 if (nstr > 38) {
00898 data.blint2 = atof(split_line[38].c_str());
00899 }
00900
00901
00902 if (nstr > 39) {
00903 data.blro2 = atof(split_line[39].c_str());
00904 }
00905 }
00906 };
00907 }
00908 }
00909 #endif